package Chapter7;
//150页程序7.8

import java.io.*;

public class BankAccount_BufferReaderTest {
    public static void main(String[] args) {
        try {
            BufferedReader in =new BufferedReader(new FileReader("myAccount.txt"));
            BankAccount aBankAccount = new BankAccount();
            aBankAccount.setOwnerName(in.readLine());
            aBankAccount.setAccountNumber(Integer.parseInt(in.readLine()));
            in.read();
            aBankAccount.deposit(Float.parseFloat(in.readLine()));
            in.close();
            System.out.println(aBankAccount);
            System.out.println(aBankAccount.getOwnerName()+" "+aBankAccount.getAccountNumber()+" "+aBankAccount.getBalance());
        }catch (FileNotFoundException e){
            System.out.println("文件未找到！");
        }catch (EOFException e){
            System.out.println("文件读取异常，可能已损坏！");
        }catch (IOException e){
            System.out.println("不能读取文件！");
        }
    }
}
